/* ----------------------------------------------------------------------------
* File: sys_logger.cpp
*
* Desc: CSysLogger class definition for system logging
*
* Created: 04/03/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#include "sys_logger.h"
#include "common.h"


CSysLogger::CSysLogger()
{
	// attach to system logger
	openlog("*** BOX SERVER ***", LOG_PID, LOG_LOCAL0);
}

CSysLogger::~CSysLogger()
{
	// detach from system logger
	closelog();
}

void CSysLogger::Print(const char* msg, ...)
{
	char buf[1024];
	va_list argptr;

	va_start(argptr, msg);
	vsnprintf(buf, sizeof(buf), msg, argptr);
	syslog(LOG_DEBUG, buf);
	va_end(argptr);
}